<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html 	xmlns="http://www.w3.org/1999/xhtml"
    	xmlns:ui="http://java.sun.com/jsf/facelets"
    	xmlns:f="http://java.sun.com/jsf/core"
    	xmlns:h="http://java.sun.com/jsf/html"
    	xmlns:p="http://primefaces.org/ui"
    	xmlns:s="http://www.suricattus.com.br/jsf/ui"
		xmlns:sf="http://www.suricattus.com.br/jsf/fn"
		xmlns:ec="http://www.b2cexpress.com.br/ecommerce"
    	xmlns:composite="http://java.sun.com/jsf/composite">

	<composite:interface>	
	
		<composite:attribute name="controller" required="true"  />
		
	</composite:interface>	
	
	<composite:implementation>	
		
		<p:fieldset>
			<legend>
				<span>
					#{labels['label.beneficiarios']}
				</span>
			</legend>
			
			<h:panelGroup id="pgBeneficiario">
				<span class="pull-right" style="margin-bottom: 10px;">
					<p:commandLink id="btnAdicionarBeneficiario" styleClass="btn btn-primary" action="#{cc.attrs.controller.adicionarBeneficiario()}" process="pgBeneficiario" update="pgBeneficiario">
						<i class="icon-plus icon-white"></i>
						<h:outputText value=" #{labels['botao.adicionar']}" />
					</p:commandLink>
				</span>
				<div class="clear" />
				<p:dataTable id="dtBeneficiario" var="_item" value="#{cc.attrs.controller.seguro.beneficiarios}" 
						styleClass="table table-bordered table-striped table-hover" emptyMessage="#{messages['msgP006']}">
		
					<p:column>  
			   			<f:facet name="header">  
			           		<h:outputText value="#{labels['label.nome']}" />  
			   			</f:facet>  
			   			<p:inputText id="nomeBeneficiario" value="#{_item.nome}" required="true" maxlength="100" styleClass="input-block-level"/>  
					</p:column>
		
		   			<p:column style="width:135px; text-align:center">  
		       			<f:facet name="header">  
		               		<h:outputText value="#{labels['label.data.nascimento']}" />  
		       			</f:facet>  
						<p:inputMask id="dataNascimentoCalculo" value="#{_item.dataNascimento}" converter="dateToGregorianCalendarConverter" styleClass="input-small" required="true" mask="mask:'99/99/9999'" validator="sqlServerDateValidator"/>
		   			</p:column>
		
		   			<p:column style="width:168px; text-align:center">  
		       			<f:facet name="header">  
		               		<h:outputText value="#{labels['label.grauParentesco']}" />  
		       			</f:facet>  
				        <h:selectOneMenu id="grauParentesco" value="#{_item.grauParentesco}" required="true" style="width: 150px">
				        	<f:selectItems value="#{utilFactory.listaGrausParentesco}" var="_item" itemLabel="#{labels[_item]}" />  
				        </h:selectOneMenu>  										
		   			</p:column>
		
		   			<p:column style="width: 120px; text-align:center">  
		       			<f:facet name="header">  
		               		<h:outputText value="#{labels['label.percentualParticipacao']}" />  
		       			</f:facet>  
						<p:inputMask id="percentualParticipacao" value="#{_item.percentualParticipacao}" styleClass="input-mini" required="true">
							<s:number convertionType="java.lang.Double" integerDigits="3" fractionDigits="0"/>
						</p:inputMask>
		   			</p:column>
		
		   			<p:column style="width:40px; text-align: center;" >
			   			<f:facet name="header">  
		    	       		<h:outputText value="#{labels['botao.remover']}" />  
		        		</f:facet>
		     			<p:commandLink id="removerButton" title="#{labels['botao.excluir']}" action="#{cc.attrs.controller.removerBenefiniciario(_item)}" process="@this" update=":#{cc.attrs.clientId}:pgBeneficiario">
							<i class="icon-trash"/>
						</p:commandLink>
		      		</p:column>  
		
				</p:dataTable>
			</h:panelGroup>	
			
		</p:fieldset>
					
	</composite:implementation>
	
</html>